<template>
	<div>
	  <div class="header">
	  	 <div class="info">
		  	 <div class="header_l">
		        <img :src="userInfo.avatar"  v-if="userInfo.avatar"/>
		        <img src="../../../../static/img/lanhu/45.png"  v-else/>		  	 			  	 	
		  	 </div>
		  	 <div class="header_m">
		  	 	<!--<div class="c1">{{userInfo.userName}}</div>-->
		  	 	<div class="c2" @click="editNickName">
		  	 		<span>昵称:{{userInfo.nickName}}</span>
		  	 	    <van-icon name="edit" size="16"/>
		  	 	</div>
		  	 	<div class="c3" @click="link('/market/manager/homePage')">
		  	 		<img src="../../../../static/img/lanhu/01.png" alt=""  style="width: 72px;height: 21px;"/>
		  	 	</div>
		  	 	
		  	 </div>
		  	 <!--<div class="header_r">
		  	 	<van-icon name="setting-o" class="icon"  @click="link('/market/manager/setPage')"/>
		  	 </div>-->
	  	 </div>
		 <div style="padding: 5px 0">  
     		<span style="color: #333;margin-right: 20px;" @click="linkList(0)">{{userInfo.myAttention}} 关注</span>
     		<span style="color: #333;margin-right: 20px;" @click="linkList(1)">{{userInfo.myFans}} 粉丝</span>
     		<span style="color: #333;" @click="linkList(2)">{{userInfo.myAdmire}} 点赞</span>
		 </div>	  	 		  	 
	  </div>	
        <confirm ref="confirm" @queryConfirm="queryConfirm" title="修改昵称"  
        	queryBtn="确认" cancelBtn="取消" :showSubTitle="false"></confirm> 	  
	 
	</div>	
</template>

<script>
import confirm from '_c/market/confirm7.vue'		
import '@/assets/reset/headReset.css'	
import {getFun} from '@/api/publicFun.js'	 
let publicFun=getFun()	
export default {	
	data() {
       return {
         url2:this.$api+'/marketorderservice/api/v1/market/userManager/',  // 获取用户信息
         url4:this.$api+'/marketuserservice/api/v1/market/playerinfo/updatePlayerinfoNicknameById',  // 编辑昵称
         userInfo:{},
         userId:''
       }
	},
	components: {
      confirm
	},		
	methods: {
		// 保存昵称
		queryConfirm(nickName){			
			let params={
			  "nuid": this.userId,
			  "snickname": nickName			
			} 
			let that=this
			this.$Axios2.Post(this.url4,params).then(function(res) {
               that.getInfo()
			})			
		},
		// 获取个人信息
		getInfo(){
		  let that=this
		  this.$Axios2.Get(this.url2+this.userId+'/'+this.userId).then(function(res) {
		  	that.userInfo=res.data
		  })
		},
		// 进入关注粉丝点赞列表
		linkList(num){						
			switch(num) {
		     case 0:
		        this.link('/market/manager/follow')
		        break;					 
		     case 1:
		        this.link('/market/manager/fans')
		        break;
		     case 2:
		        this.link('/market/manager/dz')
		        break;
			} 										
		},		
		editNickName(){
			this.$refs.confirm.showWin()
		},
	},
	mixins:[publicFun],//混入	
	mounted() {
		this.userId=this.$router.currentRoute.query.userId	
		this.getInfo()
	}
}	
</script>

<style scoped="">
.header{background: #ffd630;
padding: 0px 15px 35px;border-radius: 0 0 20px 20px;}	
.info{display: flex;}
.header_l img{width: 65px;height: 65px;border-radius: 10px;}
.header_m{flex: 1;padding-left: 10px;color: #333;}
.header_m .c1{font-weight: bold;font-size: 17px;}
.header_m .c2{font-size: 12px;margin-top: 10px;}
.header_m .c3{font-size: 12px;margin-top: 9px}
.header_r{width: 30px;}
.icon{font-weight: bold;font-size: 20px;}
.icon2{vertical-align: -3px;}
.editNick{width: 10px;height: 11px;}
.c2{display: flex;align-items: center;}
</style>